{template 'header', $module}
<div class="menu">
<table cellpadding="0" cellspacing="0">
<tr>
<td class="tab" id="add"><a href="?action=add"><span>购买排名</span></a></td>
<td class="tab" id="s3"><a href="?action=index"><span>已通过<span class="px10">({$nums[3]})</span></span></a></td>
<td class="tab" id="s2"><a href="?status=2"><span>审核中<span class="px10">({$nums[2]})</span></span></a></td>
</tr>
</table>
</div>
{if $action == 'add'}
<form method="post" action="?" onsubmit="return check();">
<input type="hidden" name="mid" value="{$mid}"/>
<input type="hidden" name="word" value="{$word}"/>
<input type="hidden" name="action" value="{$action}"/>
<table cellspacing="1" cellpadding="6" class="tb">
<tr>
<td class="tl">类型：</td>
<td class="tr"><a href="{$MODULE[$mid][linkurl]}" class="t">{$MODULE[$mid][name]}排名</a></td>
</tr>
<tr>
<td class="tl">关键词：</td>
<td class="tr"><strong>{$word}</strong></td>
</tr>
<tr>
<td class="tl">起价：</td>
<td class="tr f_red f_b">{$price}{$unit}</td>
</tr>
<tr>
<td class="tl">加价幅度：</td>
<td class="tr f_b">{if $step}{$step}{$unit}{else}不限{/if}</td>
</tr>
<tr>
<td class="tl">出价：</td>
<td class="tr"><input type="text" name="buy_price" value="{$price}" size="10" id="price" onkeyup="CA();"/></td>
</tr>
<tr>
<td class="tl">购买时长：</td>
<td class="tr">
<select name="buy_month" id="month" onchange="CA();">
{php for($i=1;$i<=$month;$i++){}
<option value="{$i}">{$i}月</option>
{php }}
</select>
</td>
</tr>
<tr>
<td class="tl">信息ID：</td>
<td class="tr">
<input type="text" name="buy_tid" value="{if $mid==4}{$_userid}{/if}" size="10" id="key_id" onfocus="select_item({$mid}, 'member');"/> <a href="javascript:select_item({$mid}, 'member');" class="t">选择..</a>  <span id="dkey_id" class="f_red"></span>
</td>
</tr>
<tr>
<td class="tl">应付总价：</td>
<td class="tr f_red f_b" id="payment">{$price}{$unit}</td>
</tr>
{if $currency == 'money'}
<tr>
<td class="tl">{$DT[money_name]}余额：</td>
<td class="tr"><span class="f_blue f_b">{$_money}{$unit}</span>&nbsp;&nbsp;<a href="charge.php?action=pay" target="_blank" class="t">[充值]</a></td>
</tr>
<tr>
<td class="tl">支付密码：</td>
<td class="tr">{template 'password', 'chip'}</td>
</tr>
{else}
<tr>
<td class="tl">{$DT[credit_name]}余额：</td>
<td class="tr"><span class="f_blue f_b">{$_credit}{$unit}</span>&nbsp;&nbsp;<a href="credit.php?action=buy" target="_blank" class="t">[购买]</a></td>
</tr>
{/if}
<tr>
<td class="tl"> </td>
<td class="tr"><input type="submit" name="submit" value="确定购买" class="btn_g"/>&nbsp;
<input type="button" value="重新选择" class="btn" onclick="Go('{$EXT[spread_url]}');"/>
</td>
</tr>
</table>
</form>

<script type="text/javascript">
function CA() {
	if(Dd('price').value.match(/^[0-9]{1,}$/)) {
		Dd('payment').innerHTML = Dd('price').value*Dd('month').value + '{$unit}';
	} else {
		Dd('price').value = '{$price}';
	}
}
function check() {
	var p = Dd('price').value;
	if(p < {$price}) {
		alert('出价不能低于起价');
		Dd('price').focus();
		return false;
	}
	if((p-{$price})%{$step} != 0) {
		alert('请按加价幅度加价');
		Dd('price').focus();
		return false;
	}
	{if $currency == 'money'}
	if(p*Dd('month').value > {$_money}) {
		alert('帐户余额不足，请先充值');
		return false;
	}
	{else}
	if(p*Dd('month').value > {$_credit}) {
		alert('您的{$DT[credit_name]}不足，请先购买');
		return false;
	}
	{/if}
	if(Dd('key_id').value.length < 1) {
		alert('请填写信息ID');
		Dd('key_id').focus();
		return false;
	}
	{if $currency == 'money'}
	if(Dd('password').value.length < 6) {
		alert('请填写支付密码');
		Dd('password').focus();
		return false;
	}
	{/if}
}
</script>

<script type="text/javascript">s('spread');m('add');</script>
{else}
<div class="ls">
<table cellpadding="0" cellspacing="0" class="tb">
<tr>
<th>关键词</th>
<th>模块</th>
<th>出价</th>
<th>单位</th>
<th>开始日期</th>
<th>结束日期</th>
<th>剩余(天)</th>
<th>投放状态</th>
<th>申请时间</th>
<th>信息</th>
</tr>
{loop $lists $k $v}
<tr onmouseover="this.className='on';" onmouseout="this.className='';" align="center">
<td><a href="{$EXT[spread_url]}{rewrite('index.php?kw='.urlencode($v['word']))}" target="_blank" class="b">{$v[word]}</a></td>
<td><a href="{$MODULE[$v[mid]][linkurl]}{rewrite('search.php?kw='.urlencode($v['word']))}" target="_blank" class="b" rel="nofollow">{$MODULE[$v[mid]][name]}</a></td>
<td>{$v[price]}</td>
<td>{if $v[currency]=='money'}{$DT[money_unit]}{else}{$DT[credit_unit]}{/if}</td>
<td>{timetodate($v[fromtime], 3)}</td>
<td>{timetodate($v[totime], 3)}</td>
<td{if $v[days]<5} class="f_red"{/if}>{$v[days]}</td>
<td>{$v[process]}</td>
<td class="f_gray px11">{timetodate($v[addtime], 5)}</td>
<td><a href="{DT_PATH}api/redirect.php?mid={$v[mid]}&itemid={$v[tid]}" target="_blank" class="b">直达</a></td>
</tr>
{/loop}
</table>
</div>
<div class="pages">{$pages}</div>
<script type="text/javascript">s('spread');m('s{$status}');</script>
{/if}
{template 'footer', $module}